<template>
  <div class="app-container">
    <el-form ref="form" :model="queryParam" :inline="true">
      <el-form-item prop="nameadmin_id" label="管理员ID" :label-width="formLabelWidth">
        <el-input v-model="queryParam.nameadmin_id" placeholder="管理员ID" type="input">
        </el-input>
      </el-form-item>
      <el-form-item prop="category_id" label="分类id" :label-width="formLabelWidth">
        <el-input v-model="queryParam.category_id" placeholder="分类id" type="input">
        </el-input>
      </el-form-item>
      <el-form-item>
        <el-button icon="el-icon-search" type="primary" @click="handleSearch">查询</el-button>
      </el-form-item>
    </el-form>
    <el-divider content-position="center">
    </el-divider>
    <div class="filter-container">
      <el-row>
        <el-col :span="12">
          <div class="grid-content">
            <el-button class="filter-item" icon="el-icon-refresh" @click="handleRefresh">刷新</el-button>
            <el-button class="filter-item" type="primary" icon="el-icon-plus" @click="handleCreate()">添加</el-button>
            <el-button v-if="this.selectedIds.length" size="small" class="filter-item mb-5" type="danger" icon="el-icon-delete" @click="handleMultiDelete">批量删除</el-button>
            <el-button @click="clearFilter">清除所有过滤器</el-button>
          </div>
        </el-col>
        <el-col :span="12">
          <el-button icon="el-icon-info" circle @click="templateVersion" style="float: right; padding: 3px 0">
          </el-button>
          <el-dropdown @command="handleTableCommand" style="float: right; padding: 3px 0">
            <span class="el-dropdown-link">
              <i class="el-icon-more el-icon--right"></i>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item command="a">配置表格</el-dropdown-item>
              <el-dropdown-item command="b" divided>移除</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <div class="grid-content">
            <el-dropdown @command="handleDropdownCommand" style="float: right; padding: 3px 0">
              <span class="el-dropdown-link">
                <i class="el-icon-menu el-icon--right"></i>
              </span>
              <el-dropdown-menu slot="dropdown">
                <el-checkbox-group v-model="checkList">
                  <el-dropdown-item command="a">
                    <el-checkbox label="nameadmin_id">
                    </el-checkbox>
                  </el-dropdown-item>
                  <el-dropdown-item command="a">
                    <el-checkbox label="category_id">
                    </el-checkbox>
                  </el-dropdown-item>
                </el-checkbox-group>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
        </el-col>
      </el-row>
    </div>
    <el-table ref="multipleTable" :data="data" tooltip-effect="dark" style="width: 100%" fit @selection-change="handleSelectMulti">
      <el-table-column type="selection" width="55" v-if="true">
      </el-table-column>
      <el-table-column prop="nameadmin_id" label="管理员ID" show-overflow-tooltip sortable="true" v-if="true">
      </el-table-column>
      <el-table-column prop="category_id" label="分类id" show-overflow-tooltip sortable="true" v-if="true">
      </el-table-column>
      <el-table-column prop="creator" label="创建人" v-if="true">
      </el-table-column>
      <el-table-column prop="created_at" label="创建时间" v-if="true">
      </el-table-column>
      <el-table-column prop="updated_at" label="更新时间" v-if="true">
      </el-table-column>
      <el-table-column label="操作" v-if="true" fixed="right">
        <template slot-scope="module">
          <el-button type="primary" icon="el-icon-edit" @click="handleUpdate(module.row)">
          </el-button>
          <el-button type="danger" icon="el-icon-delete" @click="handleDelete(module.row.id)">
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="paginate.current" hide-on-single-page :page-sizes="paginate.sizes" :page-size="paginate.limit" :layout="paginate.layout" :total="paginate.total">
    </el-pagination>
    <!----------------------------------- 新增/编辑 ---------------------------------------------->
    <el-drawer ref="drawer" size="60%" :title="drawerTitle" :visible.sync="formVisible" :before-close="handleClose" direction="rtl" @close="handleCancel">
      <div class="demo-drawer__content">
        <el-form :ref="formName" :model="formFieldsData" :rules="rules">
          <el-form-item prop="nameadmin_id" label="管理员ID" :label-width="formLabelWidth">
            <el-input v-model="formFieldsData.nameadmin_id" placeholder="管理员ID" autocomplete="off" clearable type="input">
            </el-input>
          </el-form-item>
          <el-form-item prop="category_id" label="分类id" :label-width="formLabelWidth">
            <el-input v-model="formFieldsData.category_id" placeholder="分类id" autocomplete="off" clearable type="input">
            </el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="drawer__footer">
          <el-button @click="handleCancel">取 消</el-button>
          <el-button type="primary" @click="handleSubmit" :loading="loading">{{ loading ? '提交中 ...' : '确 定' }}</el-button>
        </div>
      </div>
    </el-drawer>
  </div>
</template>
<script>
  import formOperate from '@/layout/mixin/formOperate'

  export default {
    name:'example_demo',
    mixins: [formOperate],
    data() {
      return {
        url: 'demo',
        formName: 'demo',
        formLabelWidth: '120px',
        // 用户搜索
        queryParam: {
          nameadmin_id:'',category_id:'',
        },
        formVisible: false,
        formFieldsData: {
          nameadmin_id:'',category_id:'',
        },
        loading: false,
        checkList: [],
        search: '',
	drawerTitle: 'demo',
        form: {nameadmin_id:'',category_id:'', },
        timer: null,
        // 表单验证
        rules: {
        }
      }
    },
      mounted() {},
      methods: {},
  }
</script>
